package com.ys.erp.stage_marketing_service.bean.condition;


import com.ys.erp.framework.condition.BasePageCondition;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDate;
import java.util.List;

/**
 * @author lwj
 * @date 2023/5/31
 */
@Data
public class CouponsCondition {

    @EqualsAndHashCode(callSuper = true)
    @Data
    public static class PageCouponCon extends BasePageCondition {

        private String couponName;

    }

    @Data
    public static class AddOrUpdateCouponCon {

        @Schema(description = "优惠券id")
        private Long id;

        @NotBlank(message = "券名字不能为空")
        private String couponName;

        @NotNull(message = "请选择券类型")
        @Max(value = 2, message = "请选择券类型")
        @Min(value = 0, message = "请选择券类型")
        @Schema(description = "优惠券类型")
        private Integer couponType;

        @NotNull(message = "请选择适用范围")
        @Max(value = 2, message = "请选择适用范围")
        @Min(value = 0, message = "请选择适用范围")
        @Schema(description = "适用商品范围")
        private Integer suitScopeType;

        @NotNull
        @Schema(description = "适用商品分类")
        private List<Long> suitGoodsCategoryIds;

        @NotNull
        @Schema(description = "适用商品")
        private List<Long> suitGoodsIds;

        @NotBlank(message = "请输入最低消费")
        @Pattern(regexp = "^[0-9]+(.[0-9]{1,2})?$", message = "金额格式错误")
        @Schema(description = "最低消费")
        private String minFee;

        @Pattern(regexp = "^[0-9]+(.[0-9]{1,2})?$", message = "金额格式错误")
        @Schema(description = "优惠金额")
        private String preferentialMoney;

        @Min(value = 1, message = "折扣最小为1折")
        @Max(value = 99, message = "折扣最大99折")
        @Schema(description = "折扣")
        private Integer discount;

        @NotNull
        @Schema(description = "赠送规格列表")
        private List<Long> giveGoodsSpecsIds;

        @NotNull(message = "请选择券有效期类型")
        @Max(value = 1, message = "请选择券有效期类型")
        @Min(value = 0, message = "请选择券有效期类型")
        @Schema(description = "券有效期类型")
        private Integer validType;


        @Schema(description = "优惠卷可用商品类型  实物商品0 虚拟商品1 ")
        private Integer goodsType;

        @Schema(description = "券有效期天数")
        private Integer validDays;

        @Schema(description = "券有效期开始时间")
        private LocalDate validStartTime;

        @Schema(description = "券有效期结束时间")
        private LocalDate validEndTime;

        @Schema(description = "排序")
        private Integer orderNum;

        @Schema(description = "券描述")
        private String couponDescribe;

    }

    @Data
    public static class GrantCouponCon {

        @NotNull
        private List<Long> userIds;

        private Long memberId;

        @Min(value = 0, message = "请选择用户")
        @Max(value = 1, message = "请选择用户")
        private Integer grantType;

        @NotNull
        private Long couponId;

        @NotNull
        @Min(value = 1, message = "数量只能在1-10之间")
        @Max(value = 10, message = "数量只能在1-10之间")
        private Integer quantity;

    }

    @Data
    public static class CouponStatisticsCon {
        @Schema(description = "优惠券名称")
        private String couponName;

        @Schema(description = "活动id")
        private Long activityId;

        @Schema(description = "发放方式")
        private String sendMethod;
    }

    @EqualsAndHashCode(callSuper = true)
    @Data
    @Schema(description = "分页优惠券发放记录请求对象")
    public static class PageCouponSentRecordCon extends BasePageCondition {

        @Schema(description = "优惠券id")
        private Long couponId;



    }

    @Data
    @Schema(description = "所有礼品卡请求对象")
    public static class ListGiftCardCon {


    }

    @EqualsAndHashCode(callSuper = true)
    @Data
    @Schema(description = "礼品卡下用户分页请求对象")
    public static class PageGiftCardUserCon extends BasePageCondition {

        @Schema(description = "礼品卡id")
        private Long giftCardId;

    }

}
